﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using 坦克大战.Properties;

namespace 坦克大战
{
    class 爆炸 : GameObject
    {
        public bool b是否销毁 { get;set; }
        private int 播放速度 = 1;
        private int 播放计数 = 0;
        private int index = -1;

        public Bitmap[] bit = new Bitmap[]
        {
            Resources.EXP1,
            Resources.EXP2,
            Resources.EXP3,
            Resources.EXP4,
            Resources.EXP5
        };
        public 爆炸(int x,int y)
        {
            foreach (var item in bit)
            {
                item.MakeTransparent(Color.Black);
            }
            this.X = x - bit[0].Width / 2;
            this.Y = y - bit[0].Height / 2;

        }

        public override Image 得到图像()
        {


            if (index>4)
            {
                return bit[4];
            }
            return bit[index];
        }

        public override void  Update()
        {
            播放计数++;
            index = (播放计数 - 1) / 播放速度;
            if (index > 4)
            {
                b是否销毁 = true;
            }
            base.Update();
        }
     
    }
}
